Skip to content

fix(app-shell): AI-draft notice and discard on the Hooks tab, paired actions and OWD rows - #38285

Draft
objectstack-fleet[bot] wants to merge 6 commits into
mainfrom
claude/project-thread-yb4rne
Draft

objectstack-fleet[bot] wants to merge 6 commits into
mainfrom
claude/project-thread-yb4rne

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #36660
repo:objectstack#3 · os-tesla · session_01L9qibxGxp6swERUK2T9NML

Clause-②: no
Metadata-protocol: none

维护者速读

  • 在对象设计器的「钩子」页、只读基础对象「动作」页里的配套包动作、以及共享默认值总览的每一行上,如果 AI 助手留下了未发布的改动,现在会显示一行提示,说明保存会让 AI 的改动一起生效,并给一个「放弃 AI 的改动」按钮;以前保存会悄悄把它们一起发布。
  • 属于「AI 改动要让人看见再生效」这条线:权限集和从左侧菜单打开的钩子、动作已经有这行提示,这次补齐剩下的三处。
  • 只在草稿确实来自 AI 助手时才显示,人自己的草稿不受影响;放弃只丢这一项(共享默认值这一行是整个对象)的草稿,有没保存的编辑时会先确认。如果提示出现得不对,只是多一行文字和按钮,可以直接撤回。
  • 无

What changes

  • Object designer, Hooks tab (objectHooksBuffer.ts, ObjectHooksPanel.tsx):
    • The buffer's load records which hooks have a pending draft whose provenance (readDraftChanges) names the AI assistant (isAgentDraftSurface: copilot or MCP). The set clears on an object switch and on a successful save.
    • The open hook shows StudioAiDraftNotice when its draft is the AI's and the hook is not a new one. The notice's discard calls the buffer's new discardAiDraft.
    • discardAiDraft asks engine.studio.aiDraft.discardConfirmUnsaved only when the hook holds unsaved edits. It then calls client.reset('hook', name, { state: 'draft', packageId }), the hook's own package, re-reads the list and emits the metadata refresh. A failure reads engine.studio.aiDraft.discardFailed.
  • Paired package's actions on a read-only base object (pairObjectActions.ts, ObjectActionsPanel.tsx):
    • A draft row whose provenance names the AI assistant carries aiDraft. A successful save, and a discard, put the row back to its live form.
    • The selected row shows the notice above the inspector. Discard is offered only where the row is editable.
    • discardAiDraft(name) asks only when that row holds an unsaved edit. It resets at the package the ensure door answers (pairForWrite()), never a hand-built <base>.custom name, then reloads.
  • Organization-wide defaults overview (PackageOwdOverviewPanel.tsx), seat ruling Q1 = A:
    • Each row reads its object's draft provenance. When the AI assistant wrote it, the row shows the notice with the OWD sentence, engine.studio.owd.aiDraftNotice: the whole object has the AI's unpublished changes, and saving this row makes all of them live. The plain "unpublished" chip is not shown beside it.
    • Discard drops that object's whole draft at the package (client.reset('object', name, { state: 'draft', packageId })). It asks engine.studio.owd.aiDraftDiscardConfirmUnsaved only when that row holds an unsaved edit. Other rows' unsaved edits are kept across the re-read.
  • StudioAiDraftNotice.tsx: an optional text prop, for a page that names what the draft covers. Without it the item sentence shows, as before.
  • i18n (studio namespace, en + zh): the two OWD keys above. Changeset 36660-owd-ai-draft-notice.md: @object-ui/i18n patch. @object-ui/app-shell is private.
  • The hook list rows get no AI marker (seat ruling).

Tests

Three new files, 19 cases. Each covers the AI line for copilot and for MCP, no line for a person's draft or for a draft read with no provenance, discard with nothing unsaved (no confirm, one reset at the right package), and discard over an unsaved edit both declined and confirmed.

  • ObjectHooksPanel.aiDraftNotice-36660.test.tsx (7): through the Hooks tab host and the top bar's Save. Save publishes the AI version and the line goes away.
  • DataPillar.pairActionsAiDraft-36660.test.tsx (6): a read-only base object with a paired package. The reset names the door's pair.
  • PackageOwdOverviewPanel.aiDraftNotice-36660.test.tsx (6): the row's OWD sentence, the whole object's reset, and another row's unsaved edit surviving a discard.

Acceptance notes

Verification

Failing first, then green
  • On the base sources with the new tests: 15 failed, 4 passed. The 4 are the person's-draft and no-provenance controls. Failures: Unable to find … studio-ai-draft-discard ×9, studio-ai-draft-notice ×6.
  • With the change: 3 files, 19/19 passed.
Ablation

Two parts removed on disk and restored (blob equal to HEAD afterwards): the OWD put-back of other rows' edits, and the hooks agent-surface check (any draft counts). 3 failed, 10 passed: OWD "another row keeps its edit", and hooks "a person's own pending draft" and "no provenance".

Wider runs
  • Affected test files: 328/328 files, 2574/2574 tests.
  • @object-ui/app-shell tsc --noEmit exit 0, tsc -p tsconfig.test.json exit 0. ESLint on the changed files: 0 errors, 5 warnings that were already there.
  • Derived gates at 4fd9904: 38 of 38 run, all exit 0, dispatch-gates --ran accounted. pnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped.
  • overlap-check: clean against origin/main and feat(app-shell): a create with no named package asks to pick or create one #38204 (shares the studio i18n files).
Browser reading, real console build

Vite console against a showcase backend, signed in, Studio → package → organization-wide defaults. Two objects in the package. The one with a copilot-stamped draft shows under its name: "This object has unpublished changes from the AI assistant. Saving this row makes all of them live too." with "Discard the AI’s changes" (1 line, 1 button). The other object's row shows no line.


Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibxGxp6swERUK2T9NML

…raft (failing first)

Claude-Session: https://claude.ai/code/session_01L9qibxGxp6swERUK2T9NML
Co-Authored-By: Claude <noreply@anthropic.com>
…ction and an OWD row gets the designers' line and discard

Claude-Session: https://claude.ai/code/session_01L9qibxGxp6swERUK2T9NML
Co-Authored-By: Claude <noreply@anthropic.com>
…d, and model the publish in the AI-draft pins

Claude-Session: https://claude.ai/code/session_01L9qibxGxp6swERUK2T9NML
Co-Authored-By: Claude <noreply@anthropic.com>
…raft line and confirm

Claude-Session: https://claude.ai/code/session_01L9qibxGxp6swERUK2T9NML
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 28, 2026
@objectstack-fleet

objectstack-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwsYQqi3TBx2SFE978

L1-b, the seat's L1 thread for zone o3-studio · 2026-11-28T11:42Z

席位核对 — L1 ACCEPT @ 4fd990456c5c0f5f8de7a7a0191cecebdeaa57af

Verdict: ACCEPT. No L2 is owed: Clause-②: no, Metadata-protocol: none, no narrowing, no packages/spec/src file, no governed path. The diff is console UI plus two i18n keys.

Read at this head

  • Shape (l1-face.mjs --pr 38285, CLEAN): draft, base main, Fixes #36660, 12 files, no release path. The changeset covers the published @object-ui/i18n; @object-ui/app-shell is private.
  • Fixes is right. The premise was corrected at the claim (7237651878): the permission set (feat(studio): a permission set opens full-screen at its metadata address; the sharing overview gets its own route #37089) and the left-menu hook and action (Studio 重构(2-2):通用详情改成保存即生效,AI 草稿照设计器的规则提示和放弃;离开时拦未保存(浏览器后退除外) #36902) already carry the notice. The three surfaces left, (a) the Hooks tab, (b) a paired package's actions on a read-only base and (c) each OWD row, are all in the diff. With them the card's ask is met on every surface it named.
  • Claim against the surface. Every file sits in the claim's list: objectHooksBuffer.ts, ObjectHooksPanel.tsx, pairObjectActions.ts, ObjectActionsPanel.tsx, PackageOwdOverviewPanel.tsx, their three new tests, the studio i18n pair with its changeset, and StudioAiDraftNotice.tsx, which gains one optional text prop that the OWD row passes. No breach.
  • The rules, read in the code:
    • The line shows only when readDraftChanges(...) holds an entry that isAgentDraftSurface accepts (copilot, mcp), on all three surfaces.
    • The confirm shows only over an unsaved edit: the hook's dirty, the pair row's edited, the OWD row's own dirty.
    • Each discard drops one item's draft. A hook resets at the hook's package. A pair action resets at pairForWrite(), the ensure door's answer, never a spelled .custom, and a walled door is refused. An OWD row resets the whole object, as ruling Q1 = A says, at the package. The other OWD rows' unsaved edits are carried through the re-read (load(others) plus setEdits).
  • Changeset sentences read in person: two keys, en and zh, both naming the whole object; nothing renamed or removed. True.
  • Tests. Failing first: 15 red and 4 green, and the 4 green are the person's-draft and no-provenance controls. 19/19 after. The ablation turned 3 cases red, and they are the right three. The narrowed local run (328 files) is accepted: CI ran the whole UI suite on this head, Test UI 1–16 all success, with Type Check UI and Lint UI also success.
  • Browser reading: a copilot-stamped object on a real console's OWD page shows the line and the button, and the other object shows neither. The stamping method is stated in the body.
  • Checks: 45 success, 13 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check are success, and mergeable_state is clean.

Out of scope

  • The never-published discard wording. The discard's tooltip says it goes "back to the live version", but for an item the AI created and never published, the discard removes the item. The card scoped this out, and seat ruling Q2 kept it out. After this PR, though, the same button and the same wording sit on five surfaces, it is a destructive action, and no card holds the note. ⇒ To the seat's filing gate, recommended as its own card (p3, wording for the never-published case on every StudioAiDraftNotice host).

Before landing

No governed path, and the PR is under 3000 lines, so Tier H is not owed. The seat lands it on this ACCEPT at this head.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants